package com.jc.service.apilog;

import com.jc.framework.enums.Conclusion;
import com.jc.framework.enums.LogType;
import org.springframework.stereotype.Service;

import com.jc.cds.model.CustomApiLog;
import com.jc.ds.base.service.BaseServiceImpl;
import com.jc.ds.mapper.BaseCustomMapper;
import com.jc.ds.model.ApiLog;

import java.util.Date;


@Service
public class ApiLogServiceImpl extends BaseServiceImpl<ApiLog,CustomApiLog, Long> implements ApiLogService {

	@Override
	public BaseCustomMapper<CustomApiLog, Long> getCustomMapper() {
		return null;
	}

	@Override
	public void addApiLog(LogType logType, String data, Conclusion conclusion, String exmsg, String respText){
		ApiLog apiLog = new ApiLog();
		apiLog.setLogType(logType.getName());
		apiLog.setLogTypeName(logType.getDesc());
		apiLog.setCreateTime(new Date());
		apiLog.setBusinessData(data);
		apiLog.setConclusion(conclusion.getName());
		apiLog.setExceptionMsg(exmsg);
		apiLog.setRespText(respText);
		add(apiLog,false);
	}
}
